package com.getpebble.android.jskit.bridge;

import android.accounts.Account;
import android.content.Context;
import com.getpebble.android.common.auth.PblSessionManager;

public class TokenBridge {
    protected static TokenBridge sInstance;
    private final Context mContext;

    public TokenBridge(Context c) {
        this.mContext = c.getApplicationContext();
    }

    public static TokenBridge getInstance(Context c) {
        if (sInstance == null) {
            sInstance = new TokenBridge(c);
        }
        return sInstance;
    }

    public String getAccountId() {
        PblSessionManager sessionManager = PblSessionManager.createInstance(this.mContext);
        Account account = sessionManager.getUserAccount();
        if (account != null) {
            return sessionManager.getId(account);
        }
        return null;
    }
}
